package com.tanhua.model.vo;

import com.tanhua.model.mongo.Options;
import com.tanhua.model.mongo.Questions;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class QuestionsVo {
    private String id;
    private String question;

    private List<Options> options;

    public static QuestionsVo init(Questions questions,List<Options> options){
        QuestionsVo vo = new QuestionsVo();
        BeanUtils.copyProperties(questions,vo);
        vo.setId(questions.getId());

        vo.setOptions(options);
        return vo;
    }

}
